package com.tomorrow.runner.util;

/**
 * Created by tomorrow on 16-5-6.
 */
public class TimeUitl {
    public static String getTimeFormat(int durationMs){
        int s = durationMs % 60;
        durationMs = durationMs/60;
        int m = durationMs % 60;
        durationMs = durationMs/60;
        int h = durationMs;
        return String.format("%d:%d:%d",h,m,s);
    }

    public static int getLastDayOfMonth(int year,int month){
        switch (month){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                return 31;
            case 4:
            case 6:
            case 9:
            case 11:
                return 30;
            case 2:
                if (year/400 == 0 || year/4 == 0){
                    return 29;
                }
                return 28;
        }
        return 30;
    }
}
